/**
 * 
 */
package com.jysz.webcore.ssh.web.interceptor;

import java.util.TimeZone;

import com.jysz.webcore.ssh.web.struts2.SshAction;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;


/**
 * 设置时区，在Linux下部署的话，最好设置此拦截机
 * @author kacarich email:javaengine@outlook.com
 *
 */
public class TimezoneInterceptor extends AbstractInterceptor {

	private static final long serialVersionUID = 1L;

	public String intercept(ActionInvocation invocation) throws Exception {
		TimeZone.setDefault(TimeZone.getTimeZone("GMT+0800"));
		SshAction action = (SshAction) invocation.getAction();
		action.setActionExecTime(System.currentTimeMillis());
		return invocation.invoke();
	}
}
